package com.newly.common.base.entity.sys.auth.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.newly.common.base.constants.AuthConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author gjm guan
 * @date 2021/10/18 14:09
 * @desc 权限实体
 */
@ApiModel(value = "权限实体")
@Data
@TableName("auth_entity")
public class AuthEntityPo implements Serializable {
    /**
     * 实体权限id
     */
    @ApiModelProperty(value = "实体权限id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 实体id
     */
    @ApiModelProperty(value = "实体id")
    private String entityId;

    /**
     * 权限id
     */
    @ApiModelProperty(value = "权限id")
    private Integer roleId;

    /**
     * 标注实体权限属性的类型
     */
    @ApiModelProperty(value = "标注实体权限属性的类型")
    private Integer type;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    private String remark;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    private static final long serialVersionUID = 1L;

    public AuthEntityPo(AuthConstant.AuthEntityType entityType, Integer roleId, String entityId) {
        this.type = entityType.getCode();
        this.remark = entityType.getRemark();
        this.roleId = roleId;
        this.entityId = entityId;
    }

    public AuthEntityPo() {
    }
}